package com.zmn.oms.model.vo.conf.attachment;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


/**
 * 类描述：服务分类
 *
 * @author 魏来
 * @modifier
 * @since 2022年6月9日 15:01:44
 */
@Data
public class ServerClassDataBO implements Serializable {
    private Integer id;
    private String otherId;
    private String name;
    private String typeName;
    private Boolean status;
    private List<ServerClassDataBO> children;
    private Integer parentId;
    private List<ServerClassDataBO> products;
    private Integer sort;

    public ServerClassDataBO(Integer id, String name, Integer parentId, String otherId, String typeName) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.otherId = otherId;
        this.typeName = typeName;
        this.status = true;
    }

    public void addChildren(ServerClassDataBO serverClassData){
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(serverClassData);
    }

    public void addProduct(ServerClassDataBO serverClassData){
        if (this.products == null) {
            this.products = new ArrayList<>();
        }
        this.products.add(serverClassData);
    }

}

